import { createStore, applyMiddleware, compose } from 'redux';

import thunk from 'redux-thunk'

import rootReducers from './reducers'

console.log(process.env.NODE_ENV)

let store = null;

if(!(window.__REDUX_DEVTOOLS_EXTENSION__ || window.__REDUX_DEVTOOLS_EXTENSION__)) {
    store = createStore(rootReducers, applyMiddleware(thunk))
} else {
    store = createStore(rootReducers, compose(applyMiddleware(thunk), window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__()))
}


export default store
